
package br.com.beiramar.action.TesteGerarActionPdf;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

import javax.faces.context.FacesContext;
import javax.servlet.http.HttpServletRequest;

import org.jboss.seam.ScopeType;
import org.jboss.seam.annotations.In;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Out;
import org.jboss.seam.annotations.Scope;

import br.com.beiramar.action.TesteGeraPdf.GerarPdfTeste;
import br.com.beiramar.entity.pessoa.testeDaniloPdf.Teste;



@Name("testeGerarAction")
@Scope(ScopeType.SESSION)
public class TesteGerarAction implements Serializable{
	
	@In(create=true, required=false)
	@Out(required=false, scope=ScopeType.CONVERSATION)
	private Teste tela = new Teste ();
			
	
	public Teste getTela() {
		return tela;
	}



	public void setTela(Teste tela) {
		this.tela = tela;
	}



	//******************************************** METODO PRINCIPAL PARA GERAR O RELATORIO DE RATEIO
	public String gerarTeste(){
		System.out.println(tela.getCpf());
		System.out.println(tela.getNome());
	
		
		
		
//		//GERAR PFD
		
	
		Map<String, Object> parametros = new HashMap<String, Object>();  
		parametros.put("TESTE", this.tela);
		
    	HttpServletRequest request = (HttpServletRequest) FacesContext.getCurrentInstance().getExternalContext().getRequest();
    	String reportUrlReal = request.getRealPath("/testeDanilo/modelo.jasper");
		new GerarPdfTeste(reportUrlReal, parametros);
		
//		//GERAR PDF
//		
		
		return "";
	}
	
	
		
}
